function getEdataMenu() {
    var result = {};
    $.ajax({
        url: "/ajax/permission/getmenu",
        async: false, //改为同步方式 
        type: "GET",
        data: null,
        beforeSend:function(request){
            request.setRequestHeader("authStr", window.localStorage.getItem("userId")+"-"+window.localStorage.getItem("token"));
        },
        success: function (data) {
            if (data.success == true) {
                result = data;
            }
        }
    });
    return result;
}

var edatamenu = {};
if (!window.localStorage) {
    console.log(浏览器不支持localStorage);
    edatamenu = getEdataMenu().data;
} else {
    var storage = window.localStorage;
    if (storage.edatamenu && storage.getItem('edatamenu')!="undefined") {
        edatamenu = JSON.parse(storage.getItem('edatamenu'));
    } else {
        edatamenu = getEdataMenu().data;
        storage.setItem("edatamenu", JSON.stringify(edatamenu));
    }
}

// console.log(edatamenu);

var menu_str = "";
var mbx_str = "";

menu_str = '<div class="menu_dropdown bk_2">';
edatamenu.forEach(emenu => {
    menu_str += '<dl id="menu-article">';
    menu_str += '<dt><i class="Hui-iconfont">'+emenu.method+'</i>'+emenu.name+'<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt>';
    menu_str += '<dd><ul>';
    emenu['children'].forEach(emc => {
        menu_str += '<li><a href="/console/'+emc.method+'/list.html" title="'+emc.name+'">'+emc.name+'</a></li>';
    });
    
    menu_str += '</ul></dd>';
    menu_str += '</dl>';
});

menu_str += '</div>';

// 目录
$("#menu").append(menu_str);
